const app = getApp()
Page({
  // onLoad () {
  //   this.getUserProfile()
  // },
  onShow () {
    this.getUserProfile()
  },
  async getUserProfile () {
    const {
      code,
      data: { avatar, nickName }
    } = await wx.http.get('/userInfo')
    if (code !== 10000) return wx.utils.toast()
    this.setData({ avatar, nickName })
    app.setUserInfo('avatar', avatar)
    app.setUserInfo('nickName', nickName)
  }
})
